﻿namespace TraceView.UI.Entities
{
    public sealed class CategoryInfo : FilterEntity
    {
        private string _category;

        public CategoryInfo(string category)
        {
            Category = category;
        }

        public string Category
        {
            get { return _category; }
            set { SetProperty(() => Category, ref _category, value); }
        }

        public override string KeyValue
        {
            get { return Category; }
        }
    }

    public sealed class CategoryCollection : FilterEntityCollection<CategoryInfo>
    {
        protected override bool TraceItemMatches(CategoryInfo item, TraceItem traceItem)
        {
            return traceItem.Categories.Contains(item.Category);
        }
    }
}